package Domd3;

public class tex {
    public static void main(String[] args) {
        tex texs = new tex();
        texs.max();//最大数
        texs.sum();//累加求和
    }

    public void max() {
        int[] arrays = {22, 24, 76, 12, 21};
        int max = arrays[0];
        for (int i = 0; i < arrays.length; i++) {
            if (arrays[i] > max) {
                max = arrays[i];
            }
        }
        System.out.println(max);

    }

    public void sum() {
        int sum = 0;
        for (int i = 1; i < 100; i++) {
            if (i % 2 != 0) {
                sum += i;
            }
        }
        System.out.println(sum);
    }
}

 class Student{
static {
    System.out.println("静态代码块...Student执行了.....");
}
    {
        System.out.println("实例代码块...Student执行了.....");
    }

    public Student() {
        System.out.println("构造代码块...Student执行了.....");
    }
}

class bOb extends Student{
    private int ID;
static {
    System.out.println("静态代码块...bob执行了.....");

}
    {
        System.out.println("实例代码块...bob执行了.....");
    }
    public bOb(int ID) {
        super();
        this.ID = ID;
        System.out.println("构造代码块...bob执行了.....");
    }
}

class lisa extends Student{
    private int ID;
    static {
        System.out.println("静态代码块...lisa执行了.....");
    }
    {
        System.out.println("实例代码块...lisa执行了.....");
    }
    public lisa(int ID) {
        super();
        this.ID = ID;
        System.out.println("构造代码块...lisa执行了.....");
    }
}
